package com.avl;

public class AVLTreeDemo {
    public static void main(String[] args) {
        int arr[] = {10,11,7,6,8,9};
        AVLTree avlTree = new AVLTree();
        for(int n: arr){
            avlTree.add(new Node(n));
        }
        avlTree.infixOrder();
        //4,3,6,5,7,8 -> 4,1,3 -> 3,2,2
        //10,12,8,9,7,6 -> 4,3,1 -> 3,2,2
        int height = avlTree.getRoot().height();
        System.out.println("未平衡之前树的高度："+height);
        int leftHeight = avlTree.getRoot().leftHeight();
        System.out.println("左子树高度："+leftHeight);
        int rightHeight = avlTree.getRoot().rightHeight();
        System.out.println("右子树高度："+rightHeight);
    }
}
